package com.weakteam.orderonline.adminconsole.spring;

import com.weakteam.orderonline.adminconsole.bean.ApplicationConfig;
import com.weakteam.orderonline.adminconsole.bean.ImageStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;

/**
 *
 * @author Nail
 */

@Configuration
@ComponentScan(basePackages={"com.weakteam.orderonline.adminconsole.bean"})
public class AppConfig {

    private static final Logger log = LoggerFactory.getLogger(AppConfig.class);

    @Bean
    public ApplicationConfig applicationConfig() {
        ApplicationConfig applicationConfig = new ApplicationConfig();
        return applicationConfig;
    }

    @Bean
    public ImageStore imageStore() {
        ImageStore imageStore = new ImageStore();
        return imageStore;
    }

    @Bean
    public PropertiesFactoryBean mainDataProperties() {
        PropertiesFactoryBean propertiesFactory = new PropertiesFactoryBean();
        propertiesFactory.setLocation(new ClassPathResource("MainData.properties"));
        return propertiesFactory;
    }


}
